package Test;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class B2 extends JFrame implements MouseListener, MouseMotionListener {
    JButton j;
    JPanel jPanel1;
    public B2() {


        setForeground(Color.white);
        setBackground(Color.WHITE);
        setTitle("alm");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100,100,1200,900);

        jPanel1=new JPanel();
        jPanel1.setBounds(100,100,650,600);
        jPanel1.setBorder(new EmptyBorder(10,10,10,10));
        jPanel1.setLayout(new BorderLayout(0,0));
        setContentPane(jPanel1);


        j=new JButton("按钮");
        j.setFont(new Font("宋体",Font.BOLD,20));
        j.setBackground(Color.white);
        j.setBounds(400,400,130,40);
        j.addMouseListener(this);
        this.addMouseMotionListener(this);
        jPanel1.add(j);




    }

    @Override
    public void mouseClicked(MouseEvent e) {
        if (e.getSource()==j){
            FileDialog d=new FileDialog(this);
            d.addMouseListener(this);
            d.setVisible(true);
            System.out.println("被点击了");

        }

    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }

    @Override
    public void mouseDragged(MouseEvent e) {

    }

    @Override
    public void mouseMoved(MouseEvent e) {

    }

    public static void main(String[] args) {
        B2  n=new B2();
        n.setVisible(true);
    }
}
